package cn.edu.sdjzu.xg.eagle.bysj.service.impl;


import cn.edu.sdjzu.xg.eagle.bysj.Mapper.UsersMapper;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import cn.edu.sdjzu.xg.eagle.bysj.utils.PageUtils;
import cn.edu.sdjzu.xg.eagle.bysj.utils.Query;



import cn.edu.sdjzu.xg.eagle.bysj.entity.UsersEntity;
import cn.edu.sdjzu.xg.eagle.bysj.service.Interface.UsersServiceInterface;
import cn.edu.sdjzu.xg.eagle.bysj.entity.view.UsersView;

@Service("usersService")
public class UsersServiceImpl extends ServiceImpl<UsersMapper, UsersEntity> implements UsersServiceInterface {


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<UsersEntity> page = this.selectPage(
                new Query<UsersEntity>(params).getPage(),
                new EntityWrapper<UsersEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<UsersEntity> wrapper) {
        Page<UsersView> page =new Query<UsersView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<UsersView> selectListView(Wrapper<UsersEntity> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public UsersView selectView(Wrapper<UsersEntity> wrapper) {
        return baseMapper.selectView(wrapper);
    }




}
